/* 
 *	Copyright (C) 2009-2010 miaohua
 *	http://code.google.com/p/lrcshower/
 *
 *  This Program is free software; you can redistribute it and/or modify
 *  it under the terms of the GNU General Public License as published by
 *  the Free Software Foundation; either version 2, or (at your option)
 *  any later version.
 *   
 *  This Program is distributed in the hope that it will be useful,
 *  but WITHOUT ANY WARRANTY; without even the implied warranty of
 *  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
 *  GNU General Public License for more details.
 *   
 *  You should have received a copy of the GNU General Public License
 *  along with GNU Make; see the file COPYING.  If not, write to
 *  the Free Software Foundation, 675 Mass Ave, Cambridge, MA 02139, USA. 
 *  http://www.gnu.org/copyleft/gpl.html
 *
 */

#pragma once
#include "Config.h"

typedef const WCHAR* (*pGetEgineName)();
typedef unsigned int (*pSearchSong)(const tstring & songName, tstring & errMsg, SongList & List, int page);
typedef unsigned int (*pSearchLrc)(const tstring & songName, const tstring & singer, tstring & errMsg, LrcList & List, int page);
typedef bool (*pGetDownloadUrl)(int idx, tstring & url);
typedef bool (*pGetEngineLogo)(HBITMAP & logo);


const char * ProcName[]=
{
"GetEgineName",
"SearchSong",
"SearchLrc",
"GetDownloadUrl",
"GetEngineLogo"
};

inline bool EnginePluginCheck(HINSTANCE instLib)
{
         pGetEgineName GetName;
         pSearchSong        SearchSong;
         pSearchSong        SearchLrc
         pGetDownloadUrl GetUrl;
         pGetEngineLogo GetLogo;

          GetName = (pGetEgineName) GetProcAddress(instLib, ProcName[0]);
          if( GetName == NULL ) 
               return false;

          SearchSong = (pSearchSong) GetProcAddress(instLib, ProcName[1]);
          if( SearchSong == NULL ) 
               return false;

          SearchLrc = (pSearchLrc) GetProcAddress(instLib, ProcName[2]);
          if( SearchLrc == NULL ) 
               return false;


          GetUrl = (pGetDownloadUrl) GetProcAddress(instLib, ProcName[3]);
          if( GetUrl == NULL ) 
               return false;

          GetLogo = (pGetEngineLogo) GetProcAddress(instLib, ProcName[4]);
          if( GetLogo == NULL )
                return false;

          return true;
}